<?php
namespace app\admin\model;

use think\Model;
use think\Db;

class Tools extends Model
{
    // 
    public function codeok($arr){
        $res = array();
        $res['code'] = '1000';
        $res['msg'] = '成功';
        return $res;
    }
    public function timeSetQQ($d){  
        if(!is_null($d)){
            $t = intval(((
                time() - $d)/3600)/24);
        }else{
            return '未知';
        }
        $now_year = date('Y',time());
        $wx_year = date('Y',$d);
        if($now_year == $wx_year){
            switch ($t) {
                case 0:
                    return '今天 '.date('H:i',$d);
                    break;
                case 1:
                    return '昨天 '.date('H:i',$d);
                    break;
                case 2:
                    return '前天 '.date('H:i',$d);
                    break;
                
                default:
                    return date('m月d日',$d);
            }
        }else{
            return date('Y年m月d日',$d);
        }
    }
    public function timeSetDate($d){
        return date('Y年m月d日',$d);
    }
}
